<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
//www.baidu.com=>www.ucai.com
//^www\.[a-z0-9]{2,16}[(\.com)|(\.cn)]{1,2}$

var str = prompt('请输入网址');
var re = /^www\.[a-z0-9]{2,16}(\.com|\.cn){1,2}$/g;
if (re.test(str))
{
	var newstr = str.replace(re,function(a){
		return 'www.ucai.com'
	});
	alert(newstr);
}else{
	alert('不是网址，请从新输入');
};
</script>
